Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for column identities #164

Merged
merged 1 commit into from
Sep 3, 2024

Conversation

bplunkett-stripe
Copy link
Collaborator

@bplunkett-stripe bplunkett-stripe commented Aug 30, 2024

Description

Add support for column identities. This is different from generated columns.

Motivation

Fixes #163

Testing

Passes CI

@bplunkett-stripe bplunkett-stripe force-pushed the bplunkett/add-support-for-column-identities branch 4 times, most recently from 55eb067 to 0d80311 Compare August 31, 2024 07:30
@bplunkett-stripe bplunkett-stripe force-pushed the bplunkett/add-support-for-column-identities branch from 0d80311 to 6ca546f Compare August 31, 2024 07:34
@bplunkett-stripe bplunkett-stripe marked this pull request as ready for review August 31, 2024 07:34
@bplunkett-stripe bplunkett-stripe added the enhancement New feature or request label Aug 31, 2024
Copy link
Collaborator

@alexaub-stripe alexaub-stripe left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! One nit

var identity *ColumnIdentity
if len(column.IdentityType) > 0 {
identity = &ColumnIdentity{
Type: ColumnIdentityType(column.IdentityType),
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should there be an error check here in case an unexpected type is returned?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No! This is very intentional. This enables us to diff schemas without erroring out if the column identity doesn 't change. You could imagine Postgres adds a new column identity. If we errored here, our tooling would totally break even if the column doesn't change. Instead, we should aim to error out within the SQL generator, i.e., only if what we don't know about changes

@bplunkett-stripe bplunkett-stripe merged commit ba73d0a into main Sep 3, 2024
8 checks passed
@bplunkett-stripe bplunkett-stripe deleted the bplunkett/add-support-for-column-identities branch September 3, 2024 16:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add support for identity columns
2 participants